package com.fcscs.cservice.gwt.client;

import java.util.Date;
import java.util.List;

import com.fcscs.core.common.SearchResultsContainer;
import com.fcscs.cservice.common.CServiceCommonEnums.BookingStatus;
import com.fcscs.cservice.common.CServiceCommonEnums.BookingViewOrderBy;
import com.fcscs.cservice.common.CServiceCommonEnums.GuestProfileType;
import com.fcscs.cservice.domain.BookingBase;
import com.fcscs.cservice.domain.model.BookingIdAndMessage;
import com.fcscs.cservice.domain.model.BookingIdAndStatus;
import com.fcscs.cservice.domain.model.BookingUpdate;
import com.fcscs.cservice.domain.model.BookingView;
import com.fcscs.cservice.domain.model.NonInHouseGuestProfile;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("../gwt/booking")
public interface BookingService extends RemoteService{

	/**
	 * @param <E>
	 * @param cls
	 * @param id
	 * @return
	 */
	<E extends BookingBase> E get(E cls, long id);

	/**
	 * @param id
	 * @return
	 */
	BookingBase get(long id);

	/**
	 * @param loc
	 * @return 
	 */
	Boolean delete(BookingBase loc);

	/**
	 * @param loc
	 */
	void permDelete(BookingBase loc);

	/**
	 * @param <E>
	 * @param loc
	 * @return  E
	 */
	<E extends BookingBase> E save(E loc);

	
	/**Advance Find booking
	 * @param propId property id
	 * @param restaurantId restaurant id
	 * @param term 
	 * @param firstName match guest firstName
	 * @param lastName  match guest lastName
	 * @param mobileNo  match phone number
	 * @param reservationDate reservation date ,can be null default current Date
	 * @param statuses bookingStatus list of bookingStatus
	 * @param start index 
	 * @param resultCnt max result limit
	 * @param orderBy bookingViewOrderBy
	 * @param sortDesc
	 * @return the list of bookingView and total count for paging
	 */
	SearchResultsContainer<BookingView> findBookings(long propId, Long restaurantId, String term, String firstName,
			String lastName, String mobileNo, GuestProfileType guestType,Date reservationDate, List<BookingStatus> statuses, Date startDate, Date endDate,
			int start,int resultCnt, BookingViewOrderBy orderBy, boolean sortDesc);

	
	/**simple findBooking
	 * @param propId 
	 * @param restaurantId
	 * @param term match guest firstName,guest lastName,guest phone number ,can be null for all(current date) 
	 * @param start index
	 * @param resultCnt max result limit
	 * @return  the list of bookingView and total count for paging
	 */
	SearchResultsContainer<BookingView> simFindBookings(long propId,Long restaurantId,String term,Date reservationDate,int start,int resultCnt);

	/**
	 * updateBookingStatus 
	 * @param propId property id
	 * @param idstatus list of bookingIdAndStatus
	 * @return the list of bookingIdAndMessage
	 */
	List<BookingIdAndMessage> updateBookingStatus(long propId,List<BookingIdAndStatus> idstatus);
	
	
	/**
	 * getBookingHistory 
	 * @param propId property id
	 * @param guestId guest profile id
	 * @param start 0 based start index
	 * @param resultCnt max result count limit
	 * @return the list of bookingView and total count for paging
	 */
	SearchResultsContainer<BookingView> getBookingHistory(long propId,long guestId, int start, int resultCnt); 
	
	
	/**
	 * crreateBooking 
	 * @param bkBase BookingBase
	 * @param nonInGuest non-in-house guestProfile
	 * @return BookingView
	 */
	BookingView createBooking(BookingBase bkBase,NonInHouseGuestProfile nonInGuest);
	
	/**
	 * @param bookingUpdate BookingUpdate model
	 * @return
	 */
	BookingView updateBooking(BookingUpdate bookingUpdate);
	
}
